package com.lq.ecoldchain.ui.main.orderlist

import android.support.v4.app.Fragment
import com.lq.ecoldchain.R
import com.lq.ecoldchain.base.view.BaseFragment
import com.lq.ecoldchain.common.FragmentViewPagerAdapter
import com.lq.ecoldchain.databinding.FragmentOrderMineBinding
import com.lq.ecoldchain.ui.main.orderlist.mineintroduction.MineIntroductionFragment
import com.lq.ecoldchain.ui.main.orderlist.order.MineOrderFragment
import com.lq.ecoldchain.ui.main.orderlist.order.list.MineOrderListDelegate
import com.lq.ecoldchain.ui.main.orderlist.order.list.orderKodeinModel
import com.lq.ecoldchain.util.StateUtil
import kotlinx.android.synthetic.main.fragment_oder.*
import org.kodein.di.Kodein
import org.kodein.di.generic.instance

/*
*2018/12/24 0024  18:32
*订单 by lq
*/
class OrderFragment: BaseFragment<FragmentOrderMineBinding>(){
    override val layoutId= R.layout.fragment_oder
    override val viewDelegate: MineOrderListDelegate by instance()

    override fun initView() {
//        StateUtil.viewMarginStateBar(mainOrderListLL)
        introductionTabLayout.setupWithViewPager(introductionViewPager)
        val fragments = ArrayList<Fragment>()
        fragments.add(MineOrderFragment())//我的接单
        fragments.add(MineIntroductionFragment())//我的介绍
        val titles :Array<String> = arrayOf("我的接单","我的介绍")
        introductionViewPager.adapter = FragmentViewPagerAdapter(childFragmentManager,fragments,titles)
        for(i in 0 until  titles.size){
            introductionTabLayout.getTabAt(i)?.text = titles[i]
        }
    }

    override val kodein: Kodein = Kodein.lazy {
        extend(parentKodein)
        import(orderKodeinModel)
    }


}